package com.edu.springboot.config;


import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@ControllerAdvice
public class  FdControllerHandle {

     @ExceptionHandler
     @ResponseBody
    public  String handle(Exception exception) throws  Exception{
        return "发现异常 错误信息" + exception.getMessage();
    }

    @ExceptionHandler(NullPointerException.class)
    @ResponseBody
    public  String handleNPE(Exception exception) throws  Exception{
        return "发生空指针异常 错误信息是" + exception.getMessage();
    }

}
